{
module Language.Java.Parser.Parser where
import Language.Java.Parser.Lexer
import Language.Java.Parser.AST
}


%name java
%tokentype { Token }
%error { parseError }
%token
  "import"                              { TImport _ }
  "package"                             { TPackage _ }
  "abstract"                            { TAbstract _ }
  "private"                             { TPrivate _ }
  "protected"                           { TProtected _ }
  "final"                               { TFinal _ }
  "enum"                                { TEnum _ }
  "class"				{ TClass _ }
  "new"					{ TNew _ }
  "static"				{ TStatic _ }
  "void"				{ TVoid _ }
  "public"				{ TPublic _ }
  "return"                              { TReturn _ }
  "extends"				{ TExtend _ }
  "byte"                                { TByte _ }
  "short"                               { TShort _ }
  "int"				        { TInt _ }
  "long"                                { TLong _ }
  "float"                               { TFloat _ }
  "double"                              { TDouble _ }
  "char"                                { TChar _ }
  "boolean"				{ TBool _ }
--  "String"                              { TString _ }
  "if"				        { TIf _ }
  "else"				{ TElse _ }
  "true"				{ TTrue _ }
  "false"				{ TFalse _ }
--  "this"				{ TThis _ }
--  "length"				{ TLength _ }
  "while"				{ TWhile _ }
  "for"                                 { TFor _ }
  string                                { TStringLiteral _ _ }
  char                                  { TCharLiteral _ _ }
  integer_literal			{ TIntLiteral _ _ }
  ident		                        { TIdent _ _ }
  "{"	 	 	   		{ TLeftBrace _ }
  "}"					{ TRightBrace _ }
  ","					{ TComma _ }
  "["					{ TLeftBrack _ }
  "]"					{ TRightBrack _ }
  op                                    { TOp _ _}
  oppm                                  { TOpPM _ _ }
  comop                                 { TComOp _ _ }
  "("                                   { TLeftParen _ }
  ")"                                   { TRightParen _ }
  ";"                                   { TSemiColon _ }
  ":"                                   { TColon _ }
  "."                                   { TPeriod _ }
  "!"                                   { TNot _ }
  assop                                 { TAssOp _ _ }
  ".*"                                  { TImportAll _ }
  "++"                                  { TIncrement _ }
  "--"                                  { TDecrement _ }
  "?"                                   { TQMark _ }
  "~"					{ TBitwiseNot _ }
  "()"                                  { TParentheses _ }
  "[]"                                  { TBrackets _ }
  "case"                                { TCase _ }
  "switch"                              { TSwitch _ }
  "break"                               { TBreak _ }
  "continue"                            { TContinue _ }
  "default"                             { TDefault _ }

%%

Program :
    PackageDecl ImportDeclList ClassDeclList { Programm (programSrcSpan $1 $2 $3) $1 $2 $3}

ClassDeclList :
          ClassDecl                 { ClassDeclList (classSrcSpan $1) $1 CEmpty }
          | ClassDeclList ClassDecl { ClassDeclList (SrcSpan (classDeclListSrcFrom $1) (srcTo $ classSrcSpan $2)) $2 $1 } 
          |                         { CEmpty }

ClassDecl : 
          Modifiers "class" ident "{" ClassMemberList "}"                     { ClassDecl (classDeclarationSrcSpan $1 (tokenPosn $2) (tokenPosn $6)) $1 (IdentLit (tokenStringValue $3)) (IdentLit "void") $5 }
          | Modifiers "class" ident "extends" ident "{" ClassMemberList "}"   { ClassDecl (classDeclarationSrcSpan $1 (tokenPosn $2) (tokenPosn $8)) $1 (IdentLit (tokenStringValue $3)) (IdentLit (tokenStringValue $5)) $7 }
          | Modifiers "enum" ident "{" ExpList "}"                            { ClassEnum (classDeclarationSrcSpan $1 (tokenPosn $2) (tokenPosn $6)) $1 (IdentLit (tokenStringValue $3)) $5 }

ClassMemberDecl :
        MethodDecl              {ClassMemberMethod (methodSrcSpan $1) $1}
        | ConstructorDecl       {ClassConstructor (constrScrSpan $1) $1 }
        | Statement             {ClassMemberStatement (stmSrcSpan $1) $1}
        | Modifiers VarDecl ";" {ClassMemberVar (SrcSpan (modifiersSrcFrom $1) (tokenPosn $3)) $2}

ClassMemberList :
        ClassMemberDecl                     { ClassMemberList (classMemberSrcSpan $1) $1 CMEmpty }
        | ClassMemberList ClassMemberDecl   { ClassMemberList (SrcSpan (classMemberListSrcFrom $1) (srcTo $ classMemberSrcSpan $2)) $2 $1 }
        |                                   { CMEmpty }

ConstructorDecl :
     Modifiers ident "(" FormalList ")" "{" StatementList "}" { ConstructorDecl (SrcSpan (modifiersSrcFrom $1) (tokenPosn $8)) (IdentLit (tokenStringValue $2)) $4 $7 }
     | Modifiers ident "()" "{" StatementList "}" { ConstructorDecl (SrcSpan (modifiersSrcFrom $1) (tokenPosn $6)) (IdentLit (tokenStringValue $2)) FEmpty $5 }

MethodDecl : 
     Modifiers Type ident "(" FormalList ")" "{" StatementList "}" { MethodDecl (SrcSpan (modifiersSrcFrom $1) (tokenPosn $9)) $2 (IdentLit (tokenStringValue $3)) $5 $8 }
     | Modifiers Type ident "()" "{" StatementList "}" { MethodDecl (SrcSpan (modifiersSrcFrom $1) (tokenPosn $7)) $2 (IdentLit (tokenStringValue $3)) FEmpty $6 }

FormalList :
     Type ident       { FormalList (SrcSpan (srcFrom $ typeSrcSpan $1) (incColNumS (tokenPosn $2) (tokenStringValue $2)) ) $1 (IdentLit (tokenStringValue $2)) FEmpty }
     | Type ident "," FormalList { FormalList ( SrcSpan (srcFrom $ typeSrcSpan $1) (srcTo $ fListSrcSpan $4) ) $1 (IdentLit (tokenStringValue $2)) $4 }
     |                  { FEmpty }

Type :
     ident            { TypeReference ( SrcSpan (tokenPosn $1)  (incColNumS (tokenPosn $1) (tokenStringValue $1)) ) (IdentLit (tokenStringValue $1)) }
     | "boolean"        { TypeBoolean (SrcSpan (tokenPosn $1) (incColNum (tokenPosn $1) 7)) }
     | "int"            { TypeInt (SrcSpan (tokenPosn $1) (incColNum (tokenPosn $1) 3)) }
     | "void"           { TypeVoid (SrcSpan (tokenPosn $1) (incColNum (tokenPosn $1) 4)) }
     | "byte"           { TypeByte (SrcSpan (tokenPosn $1) (incColNum (tokenPosn $1) 4)) }
     | "short"          { TypeShort (SrcSpan (tokenPosn $1) (incColNum (tokenPosn $1) 5)) }
     | "long"           { TypeLong (SrcSpan (tokenPosn $1) (incColNum (tokenPosn $1) 4)) }
     | "float"          { TypeFloat (SrcSpan (tokenPosn $1) (incColNum (tokenPosn $1) 5)) }
     | "double"         { TypeDouble (SrcSpan (tokenPosn $1) (incColNum (tokenPosn $1) 6)) }
     | "char"           { TypeChar (SrcSpan (tokenPosn $1) (incColNum (tokenPosn $1) 4)) }
     | Type "[]"       { TypeArray (SrcSpan (typeSrcFrom $1) (incColNum (tokenPosn $2) 2)) $1 }

Statement :
    "{" StatementList "}"                          { SList (SrcSpan (tokenPosn $1) (incColNum (tokenPosn $3) 1)) $2 }
    | "if" "(" Exp ")" Statement "else" Statement  { SIfElse (SrcSpan (tokenPosn $1) (stmSrcTo $7)) $3 $5 $7 }
    | "if" "(" Exp ")" Statement                   { SIf (SrcSpan (tokenPosn $1) (stmSrcTo $5)) $3 $5 }
    | "while" "(" Exp ")" Statement                { SWhile (SrcSpan (tokenPosn $1) (stmSrcTo $5)) $3 $5 }
    | Exp assop Exp ";"                            { SAssignment (SrcSpan (expSrcFrom $1) (incColNum (tokenPosn $4) 1)) $1 (tokenOpValue $2) $3 }
    | Exp ";"                                      { SExp (SrcSpan (expSrcFrom $1) (incColNum (tokenPosn $2) 1)) $1 }
    | "return" Exp ";"                             { SReturn (SrcSpan (tokenPosn $1) (incColNum (tokenPosn $3) 1)) $2 }
    | "for" "(" ForParam ")" Statement             { SFor (SrcSpan (tokenPosn $1) (stmSrcTo $5)) $3 $5 }
--    | "switch" "(" Exp ")" "{" CaseStatements "}"  { SSwitch dummySpan $3 $6 }
    | "break" ";"                                  { SBreak (SrcSpan (tokenPosn $1) (incColNum (tokenPosn $2) 1)) (IdentLit "") }
    | "break" ident ";"                            { SBreak (SrcSpan (tokenPosn $1) (incColNum (tokenPosn $3) 1)) (IdentLit (tokenStringValue $2)) }
    | "continue" ";"                               { SContinue (SrcSpan (tokenPosn $1) (incColNum (tokenPosn $2) 1)) (IdentLit "") }
    | "continue" ident ";"                         { SContinue (SrcSpan (tokenPosn $1) (incColNum (tokenPosn $3) 1)) (IdentLit (tokenStringValue $1)) }
    | ident ":"                                    { SLable (SrcSpan (tokenPosn $1) (incColNum (tokenPosn $2) 1)) (IdentLit (tokenStringValue $1)) }

{-
CaseStatements :
    CaseStatement                         { CaseStatementSingle dummySpan $1 }
    | CaseStatement CaseStatements        { CaseStatementList dummySpan $2 $1 }

CaseStatement :
    "case" integer_literal ":" Statement "break" ";"        { CaseStm dummySpan (show $ tokenIntValue $2) $4 }
--    | "case" ident ":" StatementList                { CaseStm dummySpan (tokenStringValue $2) $4 }
--    | "case" string ":" StatementList               { CaseStm dummySpan (tokenStringValue $2) $4 }
--    | "case" char ":" StatementList                 { CaseStm dummySpan (tokenStringValue $2) $4 }
--    | "default" ":" Statement                       { CaseStm dummySpan "default" $3 }
    
-}

ForParam :
    Type ident ":" Exp            { ForEach  (SrcSpan (srcFrom $ typeSrcSpan $1) (srcTo $ expSrcSpan $4)) $1 (IdentLit (tokenStringValue $2)) $4 }
    | Exp ";" Exp ";" Exp         { ForRange (SrcSpan (srcFrom $ expSrcSpan $1) (srcTo $ expSrcSpan $5)) $1 $3 $5 }

VarDecl :
    Type ident                       { VarDecl (SrcSpan (srcFrom $ typeSrcSpan $1) (incColNumS (tokenPosn $2) (tokenStringValue $2)) ) $1 (IdentLit (tokenStringValue $2)) }
    | Type ident assop Exp           { VarDeclAss (SrcSpan (srcFrom $ typeSrcSpan $1) (expSrcTo $4)) $1 (IdentLit (tokenStringValue $2)) $4 }

StatementList :
    Statement                   { StatementList (stmSrcSpan $1) Empty $1 }
    | StatementList Statement   { StatementList (SrcSpan (srcFrom $ stmListSrcSpan $1) (srcTo $ stmSrcSpan $2) ) $1 $2 }
    |                           { Empty }

Exp : 
    Exp op Exp                        { ExpOp (SrcSpan (expSrcFrom $1) (expSrcTo $3)) $1 (tokenOpValue $2) $3}
    | Exp oppm Exp                    { ExpOp (SrcSpan (expSrcFrom $1) (expSrcTo $3)) $1 (tokenOpValue $2) $3}
    | Exp comop Exp                   { ExpComOp (SrcSpan (expSrcFrom $1) (expSrcTo $3)) $1 (tokenOpValue $2) $3}
    | Exp "[" Exp "]"                 { ExpArray (SrcSpan (expSrcFrom $1) (incColNum (tokenPosn $4) 1)) $1 $3}
    | Exp "." Exp                     { ExpDotExp (SrcSpan (expSrcFrom $1) (expSrcTo $3)) $1 $3 }
    | Exp "(" ExpList ")"             { ExpFCall (SrcSpan (expSrcFrom $1) (incColNum (tokenPosn $4) 1)) $1 $3}
    | Exp "()"                        { ExpFCall (SrcSpan (expSrcFrom $1) (incColNum (tokenPosn $2) 1)) $1 ExpListEmpty}
    | integer_literal                 { ExpInt  (SrcSpan (tokenPosn $1) (incColNumS (tokenPosn $1) (show $ tokenIntValue $1))) (tokenIntValue $1)}
    | "true"                          { ExpBool (SrcSpan (tokenPosn $1) (incColNum (tokenPosn $1) 3)) True}
    | "false"                         { ExpBool (SrcSpan (tokenPosn $1) (incColNum (tokenPosn $1) 3)) False}
    | ident                           { ExpQualifiedIdent (SrcSpan (tokenPosn $1) (incColNumS (tokenPosn $1) (tokenStringValue $1))) (IdentLit (tokenStringValue $1)) }
    | string                          { ExpString (SrcSpan (tokenPosn $1) (incColNumS (tokenPosn $1) (tokenStringValue $1))) (IdentLit (tokenStringValue $1)) }
    | char                            { ExpChar (SrcSpan (tokenPosn $1) (incColNumS (tokenPosn $1) (tokenStringValue $1))) (IdentLit (tokenStringValue $1)) }
    | "new" Type "[" Exp "]"          { ExpNewType (SrcSpan (tokenPosn $1) (incColNum (tokenPosn $5) 1)) $4 }  
    | "new" ident "(" ExpList ")"     { ExpNewIdent (SrcSpan (tokenPosn $1)  (incColNum (tokenPosn $5) 1)) (IdentLit (tokenStringValue $2))}
    | "new" ident "()"                { ExpNewIdent (SrcSpan (tokenPosn $1) (incColNum (tokenPosn $3) 2)) (IdentLit (tokenStringValue $2))}
    | "!" Exp                         { ExpNot (SrcSpan (tokenPosn $1) (expSrcTo $2)) $2}
    | "(" Exp ")"                     { ExpParentheses (SrcSpan (tokenPosn $1) (incColNum (tokenPosn $3) 1)) $2}
    | "{" ExpList "}"                 { ExpBraces (SrcSpan (tokenPosn $1) (incColNum (tokenPosn $3) 1)) $2}
    | Exp "++"                        { ExpInc (SrcSpan (expSrcFrom $1) (incColNum (tokenPosn $2) 2)) $1 }
    | Exp "--"                        { ExpDec (SrcSpan (expSrcFrom $1) (incColNum (tokenPosn $2) 2)) $1 }
    | "++" Exp                        { ExpInc (SrcSpan (tokenPosn $1) (expSrcTo $2)) $2 }
    | "--" Exp                        { ExpDec (SrcSpan (tokenPosn $1) (expSrcTo $2)) $2 }
    | VarDecl                         { ExpVar (varDeclSrcSpan $1) $1 }
    | Exp "?" Exp ":" Exp             { ExpShortIf (SrcSpan (expSrcFrom $1) (expSrcTo $5)) $1 $3 $5 }
    | oppm Exp                        { ExpSigned (SrcSpan (tokenPosn $1) (expSrcTo $2)) (tokenOpValue $1) $2 }

ExpList :
        Exp                { ExpListExp (expSrcSpan $1) $1 }
        | ExpList ExpRest  { ExpList (SrcSpan (expListSrcFrom $1) (srcTo $ expRestSrcSpan $2)) $1 $2 }
        |                  { ExpListEmpty }

ExpRest : 
     "," Exp      { ExpRest (SrcSpan (tokenPosn $1) (srcTo $ expSrcSpan $2)) $2 }

QualifiedIdent :
        ident                         {QualifiedIdentSingle (SrcSpan (tokenPosn $1) (incColNumS (tokenPosn $1) (tokenStringValue $1))) (IdentLit (tokenStringValue $1)) }
        | QualifiedIdent "." ident    {QualifiedIdent (SrcSpan (qIdentFrom $1) (incColNumS (tokenPosn $3) (tokenStringValue $3))) $1 (IdentLit (tokenStringValue $3)) }

ImportDecl :
        "import" QualifiedIdent ";"          { ImportDecl (SrcSpan (tokenPosn $1) (incColNum (tokenPosn $3) 1)) (qIdentToString $2) }
        | "import" QualifiedIdent ".*" ";"   { ImportDecl (SrcSpan (tokenPosn $1) (incColNum (tokenPosn $4) 1)) ((qIdentToString $2)++".*") }
                
ImportDeclList :
        ImportDecl                      { ImportDeclList (importSrcSpan $1) $1 ImportEmpty }
        | ImportDecl ImportDeclList     { ImportDeclList (SrcSpan (srcFrom $ (importSrcSpan $1)) (importListSrcTo $1 $2) ) $1 $2 }
        |                               { ImportEmpty }

PackageDecl :
        "package" QualifiedIdent ";"     { PackageDecl (SrcSpan (tokenPosn $1) (incColNum (tokenPosn $3) 1)) (IdentLit (qIdentToString $2)) }
        |                                { NoPackage }

Modifier :
        "public"      { ModifierPublic (SrcSpan (tokenPosn $1) (incColNumS (tokenPosn $1) "public") ) }
        | "final"     { ModifierPublic (SrcSpan (tokenPosn $1) (incColNumS (tokenPosn $1) "final") ) }
        | "static"    { ModifierStatic (SrcSpan (tokenPosn $1) (incColNumS (tokenPosn $1) "static") ) }
        | "private"   { ModifierPrivate (SrcSpan (tokenPosn $1) (incColNumS (tokenPosn $1) "private") ) }
        | "abstract"  { ModifierAbstract (SrcSpan (tokenPosn $1) (incColNumS (tokenPosn $1) "abstract") ) }       
        | "protected" { ModifierProtected (SrcSpan (tokenPosn $1) (incColNumS (tokenPosn $1) "protected") ) }

Modifiers :
        Modifier                { Modifiers (modifierSrcSpan $1) $1 ModifierEmpty }
        | Modifiers Modifier    { Modifiers (SrcSpan (modifiersSrcFrom $1) (srcTo $ modifierSrcSpan $2)) $2 $1 }
        |                       { ModifierEmpty }


{
parseError :: [Token] -> a
parseError tokenList = let pos = tokenPosn(last(tokenList)) 
  in 
  error ("parse error at " ++ show(getLineNum(pos)) ++ ":" ++ show(getColumnNum(pos)))

{- helper functions *START* -}
modifiersSrcFrom :: Modifiers -> AlexPosn
modifiersSrcFrom (Modifiers _ m ModifierEmpty) = srcFrom $ modifierSrcSpan m
modifiersSrcFrom (Modifiers _ _ mList) = modifiersSrcFrom mList
modifiersSrcFrom ModifierEmpty = srcFrom $ dummySpan

importListSrcTo :: ImportDecl -> ImportDeclList -> AlexPosn
importListSrcTo (ImportDecl srcSpan _ ) ImportEmpty = srcTo srcSpan
importListSrcTo _ (ImportDeclList _ i iList) = importListSrcTo i iList

--importListSrcTo (ImportDeclList _ i ImportEmpty) = srcTo $ importSrcSpan i
--importListSrcTo (ImportDeclList _ _ iList) = importListSrcTo iList
--importListSrcTo ImportEmpty = srcTo $ dummySpan

qIdentToString :: QualifiedIdent -> String
qIdentToString (QualifiedIdentSingle _ i) = identToString i
qIdentToString (QualifiedIdent _ ids i) = (qIdentToString ids) ++ "." ++ (identToString i)

identToString :: Ident -> String
identToString (IdentLit s) = s

qIdentFrom :: QualifiedIdent -> AlexPosn
qIdentFrom (QualifiedIdent _ ids _) = qIdentFrom ids
qIdentFrom id = srcFrom $ qIdentSrcSpan id 

expSrcFrom :: Exp -> AlexPosn
expSrcFrom (ExpOp _ e _ _) = expSrcFrom e
expSrcFrom (ExpComOp _ e _ _) = expSrcFrom e
expSrcFrom (ExpArray _ e _) = expSrcFrom e
expSrcFrom (ExpFCall _ e _) = expSrcFrom e
expSrcFrom (ExpNot _ e) = expSrcFrom e
--expSrcFrom (ExpLength _ e) = expSrcFrom e
expSrcFrom p = srcFrom $ expSrcSpan p

expSrcTo :: Exp -> AlexPosn
expSrcTo (ExpOp _ _ _ e) = expSrcTo e
expSrcTo (ExpComOp _ _ _ e) = expSrcTo e
expSrcTo (ExpArray _ e _) = expSrcTo e
expSrcTo (ExpFCall _ e _) = expSrcTo e
expSrcTo (ExpNot _ e) = expSrcTo e
--expSrcTo (ExpLength _ e) = expSrcTo e
expSrcTo exp = srcTo $ expSrcSpan exp

expListSrcFrom :: ExpList -> AlexPosn
expListSrcFrom (ExpListExp _ e ) = srcFrom $ expSrcSpan e
expListSrcFrom (ExpList _ eList _ ) = expListSrcFrom eList
expListSrcFrom ExpListEmpty = srcFrom $ dummySpan

stmSrcTo :: Statement -> AlexPosn
stmSrcTo (SIfElse _ _ _ stm) = stmSrcTo stm
stmSrcTo (SWhile _ _ stm) = stmSrcTo stm
stmSrcTo stm = srcTo $ stmSrcSpan stm

stmListSrcFrom :: StatementList -> AlexPosn
stmListSrcFrom (StatementList _ Empty stm) = srcFrom $ stmSrcSpan stm
stmListSrcFrom (StatementList _ stmList _) = stmListSrcFrom stmList
stmListSrcFrom Empty = srcTo $ dummySpan

classDeclListSrcFrom :: ClassDeclList -> AlexPosn
classDeclListSrcFrom (ClassDeclList _ c CEmpty) = srcFrom $ classSrcSpan c
classDeclListSrcFrom (ClassDeclList _ _ classList) = classDeclListSrcFrom classList
classDeclListSrcFrom CEmpty = srcFrom $ dummySpan

classMemberListSrcFrom :: ClassMemberList -> AlexPosn
classMemberListSrcFrom (ClassMemberList _ cm CMEmpty) = srcFrom $ classMemberSrcSpan cm
classMemberListSrcFrom (ClassMemberList _ _ cmList) = classMemberListSrcFrom cmList
classMemberListSrcFrom CMEmpty = srcFrom $ dummySpan

{-
varListSrcTo :: VarDeclList -> AlexPosn
varListSrcTo vL@(VarDeclList _ _ _ VEmpty) = srcTo $ varListSrcSpan vL
varListSrcTo (VarDeclList _ _ _ vList) = varListSrcTo vList
varListSrcTo VEmpty = srcTo $ dummySpan
-}

{-
methodDeclListSrcTo :: MethodDeclList -> AlexPosn
methodDeclListSrcTo (MethodDeclList _ method MEmpty) = srcTo $ methodSrcSpan method
methodDeclListSrcTo (MethodDeclList _ _ methodList) = methodDeclListSrcTo methodList
-}

fListSrcTo :: FormalList -> AlexPosn
fListSrcTo (FormalList _ t _ FEmpty) = srcTo $ typeSrcSpan t
fListSrcTo (FormalList _ _ _ fList) = fListSrcTo fList
fListSrcTo FEmpty = srcTo $ dummySpan

typeSrcFrom :: Type -> AlexPosn
typeSrcFrom (TypeArray _ t) = typeSrcFrom t
typeSrcFrom t = srcFrom $ typeSrcSpan t


programSrcSpan :: PackageDecl -> ImportDeclList -> ClassDeclList -> SourceSpan
programSrcSpan NoPackage ImportEmpty c = classListSrcSpan c
programSrcSpan NoPackage i c = SrcSpan (srcFrom $ importListScrSpan i) (srcTo $ classListSrcSpan c)
programSrcSpan p _ c = SrcSpan (srcFrom $ packageSrcSpan p) (srcTo $ classListSrcSpan c)

classDeclarationSrcSpan :: Modifiers -> AlexPosn -> AlexPosn -> SourceSpan
classDeclarationSrcSpan (Modifiers _ modifier _) _ endPos = SrcSpan (srcFrom $ modifierSrcSpan modifier) endPos
classDeclarationSrcSpan ModifierEmpty startPos endPos = SrcSpan startPos endPos


{- helper functions *END* -}


dummySpan :: SourceSpan
dummySpan = SrcSpan (AlexPn (-1) (-1) (-1) ) (AlexPn (-1) (-1) (-1) )


main = do 
  inStr <- getContents
  let parseTree = java (alexScanTokens2 inStr)  
  putStrLn ("parseTree: " ++ show(parseTree))
  print "done"
}

